#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main() {
    double prices = 0.0, discount = 1.0;
    int month = 0, data = 0, flag = 0;
    scanf("%lf %d %d %d", &prices, &month, &data, &flag);
    if (month == 11 && data == 11)
    {
        discount = 0.7;
    }
    if (month == 12 && data == 12)
    {
        discount = 0.8;
    }
    prices = prices * discount - flag * 50;
    printf("%.2lf", prices);
    return 0;

}
